package com.edaoe.util;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Dull on 2017/3/25 0025.
 */
public class HttpUtil {

    public static String getServerUrl(HttpServletRequest request){
        StringBuilder sb=new StringBuilder();
        sb.append(request.getScheme())
                .append("://")
                .append(request.getServerName());
        if (request.getServerPort()==80)
            return sb.toString();
        return sb.append(":").append(request.getServerPort()).toString();
    }
}
